package com.authorization.project.authorization.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.authorization.framework.aspectj.lang.annotation.Log;
import com.authorization.framework.aspectj.lang.enums.BusinessType;
import com.authorization.project.authorization.domain.Secretversion;
import com.authorization.project.authorization.service.ISecretversionService;
import com.authorization.framework.web.controller.BaseController;
import com.authorization.framework.web.domain.AjaxResult;
import com.authorization.common.utils.poi.ExcelUtil;
import com.authorization.framework.web.page.TableDataInfo;

/**
 * secretversionController
 * 
 * @author 李晓雷
 * @date 2020-04-29
 */
@RestController
@RequestMapping("/authorization/secretversion")
public class SecretversionController extends BaseController
{
    @Autowired
    private ISecretversionService secretversionService;

    /**
     * 查询secretversion列表
     */
    @PreAuthorize("@ss.hasPermi('authorization:secretversion:list')")
    @GetMapping("/list")
    public TableDataInfo list(Secretversion secretversion)
    {
        startPage();
        List<Secretversion> list = secretversionService.selectSecretversionList(secretversion);
        return getDataTable(list);
    }

    /**
     * 导出secretversion列表
     */
    @PreAuthorize("@ss.hasPermi('authorization:secretversion:export')")
    @Log(title = "secretversion", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Secretversion secretversion)
    {
        List<Secretversion> list = secretversionService.selectSecretversionList(secretversion);
        ExcelUtil<Secretversion> util = new ExcelUtil<Secretversion>(Secretversion.class);
        return util.exportExcel(list, "secretversion");
    }

    /**
     * 获取secretversion详细信息
     */
    @PreAuthorize("@ss.hasPermi('authorization:secretversion:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(secretversionService.selectSecretversionById(id));
    }

    /**
     * 新增secretversion
     */
    @PreAuthorize("@ss.hasPermi('authorization:secretversion:add')")
    @Log(title = "secretversion", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Secretversion secretversion)
    {
        return toAjax(secretversionService.insertSecretversion(secretversion));
    }

    /**
     * 修改secretversion
     */
    @PreAuthorize("@ss.hasPermi('authorization:secretversion:edit')")
    @Log(title = "secretversion", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Secretversion secretversion)
    {
        return toAjax(secretversionService.updateSecretversion(secretversion));
    }

    /**
     * 删除secretversion
     */
    @PreAuthorize("@ss.hasPermi('authorization:secretversion:remove')")
    @Log(title = "secretversion", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(secretversionService.deleteSecretversionByIds(ids));
    }
}
